import sys
import os

# 添加项目根目录到Python路径
script_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.dirname(script_dir)
if project_root not in sys.path:
    sys.path.insert(0, project_root)

from training.utils.experiment_util import ExperimentResumer
from training.kfold_trainer import main
from training.utils.config_util import load_config, load_run_info, save_run_info

if __name__ == "__main__":
    # 获取当前脚本目录
    script_dir = os.path.dirname(os.path.abspath(__file__))
    # 创建实验恢复器实例并运行实验，显式传入脚本目录
    resumer = ExperimentResumer(script_dir)
    # 调用run_experiment方法，传入所需的参数
    resumer.run_experiment(main, load_config, load_run_info, save_run_info)
